package xginxnote

import (
	"encoding/json"

	"gitee.com/xiaoyutab/xgotool/optional/xnote"
	"gitee.com/xiaoyutab/xgotool/xgin"
	"gitee.com/xiaoyutab/xgotool/xstring"
	"github.com/gin-gonic/gin"
)

// 获取分页列表数据
//
//	GET	/remove.tips
func removeTips(c *gin.Context) *xgin.Response {
	type fid_struct struct {
		Id     json.Number `json:"id" form:"id"`           // 栏目ID
		MenuId json.Number `json:"menu_id" form:"menu_id"` // tips标签数ID
	}
	temp := fid_struct{}
	if err := xgin.Bind(c, &temp); err != nil {
		return xgin.Resp().Error(err)
	}
	id, mid := xstring.JUint(temp.Id), xstring.JUint(temp.MenuId)
	if id == 0 || mid == 0 {
		return xgin.Resp().ErrorEmpty()
	}
	err := xnote.DeleteMenuId(id, c.GetUint("uid"), mid)
	if err != nil {
		return xgin.Resp().Error(err)
	}
	return xgin.Resp().SuccessEmpty()
}
